<%-- 
    Document   : reportList
    Created on : Sep 2, 2012, 4:56:46 PM
    Author     : phong
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <f:view>
            <a href="signList.jsp">Sign List</a>&nbsp;|&nbsp;
            <a href="viewStatic.jsp">View Static</a>&nbsp;|&nbsp;
            <a href="reportList.jsp">Report Static</a>
            <h1>Report List</h1>
            <h:form id="reportList">
                Lab ID: <h:inputText  value="#{reportListBean.labID}"/>
                Use Date: <h:inputText  value="#{reportListBean.startDate}"/>
                <h:inputText  value="#{reportListBean.endDate}"/>
                <h:selectOneMenu value="#{reportListBean.status}">
                    <f:selectItem  itemLabel="All" itemValue="All"></f:selectItem>
                    <f:selectItem  itemLabel="In Process" itemValue="In Process"></f:selectItem>
                    <f:selectItem  itemLabel="Confirm" itemValue="Confirm"></f:selectItem>
                    <f:selectItem  itemLabel="Done" itemValue="Done"></f:selectItem>
                </h:selectOneMenu>     
                <h:commandButton value="Search" action="search"/>   
                <h:dataTable id="report" value="#{reportListBean.getReportByAdmin()}" 
                             var="report" border="1" >
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Id"/>
                        </f:facet>
                        <h:commandLink value="#{report.id}" action="reportInfo" 
                                       actionListener="#{reportBean.getReportByID(report.id)}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Device"/>
                        </f:facet>
                        <h:commandLink value="#{report.device.id}" action="deviceInfo" 
                                       actionListener="#{deviceBean.getDeviceByID(report.device.id)}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Lab ID"/>
                        </f:facet>
                        <h:commandLink value="#{report.device.lab.id}" action="labInfo" 
                                       actionListener="#{labBean.getLabByID(report.device.lab.id)}"/>
                    </h:column>  
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Sender"/>
                        </f:facet>
                        <h:commandLink value="#{report.userBySender.name}" action="userInfo" 
                                       actionListener="#{userBean.getUserByID(report.userBySender.id)}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Create Date"/>
                        </f:facet>
                        <h:outputText value="#{report.createDate}">
                            <f:convertDateTime pattern="HH:mm MM/dd/yyyy" />
                        </h:outputText>
                    </h:column>                    
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Status"/>
                        </f:facet>
                        <h:outputText value="#{report.status}"/>
                    </h:column><h:column>
                        <f:facet name="header">
                            <h:outputText value="Technician"/>
                        </f:facet>
                        <h:commandLink value="#{report.userByTechnician.name}" action="userInfo" 
                                       actionListener="#{userBean.getUserByID(report.userByTechnician.id)}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="End Date"/>
                        </f:facet>
                        <h:outputText value="#{report.endDate}">
                            <f:convertDateTime pattern="HH:mm MM/dd/yyyy" />
                        </h:outputText>
                    </h:column>
                </h:dataTable>
            </h:form>
        </f:view>
    </body>
</html>
